/*

  The contents of this file are subject to the Mozilla Public License Version
  1.1 (the "License"); you may not use this file except in compliance with
  the License. You may obtain a copy of the License at 
  
           http://www.mozilla.org/MPL/ 
  
  Software distributed under the License is distributed on an "AS IS" basis,
  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  for the specific language governing rights and limitations under the License. 
  
  The Original Code is Tamina Framework.
  
  The Initial Developer of the Original Code is
  MOUTON David (aka damo)  <damo@tamina-online.com>.
  Portions created by the Initial Developer are Copyright (C) 2004-2007
  the Initial Developer. All Rights Reserved.
  
  Contributor(s) :
  
*/
package org.tamina.utils.preload
{
	import org.tamina.core.init.IInitializable;
	import flash.utils.Dictionary;
	import flash.events.Event;
	
	public class PreloadConfig implements IPreloadConfig
	{
		//Props
		private var __initializables:Dictionary;
		
		//Constructeur
		function PreloadConfig(){
			__initializables = new Dictionary();
		}
		
		//Methodes
		
		
		/**
		 * Initialise les propriétés des composants IInitialisable
		 * @param propertiesList
		 * 
		 */
		public function setProperties(propertiesList:XML):void{
			var xl:XMLList = propertiesList.preloader.init..properties;			
			for (var i:uint=0;i<xl.length();i++){
				var ref:String = xl[i].@ref;
				var prop:String = xl[i].@name;
				var value:String = xl[i].@value;
				__initializables[ref][prop]=value;
			}
		}
		
		/**
		 * Retourne la liste des elements initialisables
		 * @return 
		 * 
		 */
		public function getInitialisables():Array{
			var result:Array = new Array;
			for(var z:String in __initializables){
				result.push(__initializables[z]);
			}
			return result;
		}
		
		/**
		 * Renseigne la liste des elements IInitialisables
		 * @param d
		 * 
		 */
		public function setInitialisables(d:Dictionary):void{
			__initializables = d;
		}
	}
}